package com.zmyuan.demo.netty.thrift.client;

import com.zmyuan.demo.netty.thrift.common.Constants;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.util.AttributeKey;

/**
 * Created by zdb on 2017/2/15.
 */
public class ThriftClientHandler extends ChannelInboundHandlerAdapter {

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {

        ctx.channel().attr(AttributeKey.valueOf(Constants.ATTRIBUTE_KEY)).set(msg);
        ctx.channel().close();
        ctx.close();
    }
}
